package stringBuilder;

import java.util.Arrays;

public class SplitDemo2 {
    public static void main(String[] args) {
        String str="a=b=c=d=e=f=======================";
        String []arr=str.split("=");
        System.out.println("arr_len"+arr.length);
        System.out.println(Arrays.toString(arr));
        System.out.println("========================================================");
        //拆出两项
        arr=str.split("=",2);
        System.out.println("arr_len="+arr.length);
        System.out.println(Arrays.toString(arr));
        //拆出三项
        arr=str.split("=",3);
        System.out.println("arr_len="+arr.length);
        System.out.println(Arrays.toString(arr));
        //拆出7项
        arr=str.split("=",7);
        System.out.println("arr_len="+arr.length);
        System.out.println(Arrays.toString(arr));
        //拆出20项
        arr=str.split("=",20);
        System.out.println("arr_len="+arr.length);
        System.out.println(Arrays.toString(arr));
        //和一个参数一样
        arr=str.split("=",0);
        System.out.println("arr_len="+arr.length);
        System.out.println(Arrays.toString(arr));
        //能拆尽拆
        arr=str.split("=",-1);
        System.out.println("arr_len="+arr.length);
        System.out.println(Arrays.toString(arr));
    }
}
